<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Template-Backend</title>

    <!-- Bootstrap Core CSS -->
    <link href="/robot_henan/Public/Admin/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/robot_henan/Public/Admin/js/plugins/metisMenu/metisMenu.min.css" rel="stylesheet">
    <link href="/robot_henan/Public/Admin/js/plugins/metisMenu/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/robot_henan/Public/Admin/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- Custom CSS -->
    <style>
    body {
        padding-top: 70px;
        /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
    }

    .list-group-item-aaa {
        background-color: red;

    }
    </style>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>
    <!-- Navigation -->
    <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">Start Bootstrap</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="<?php echo U('Home/Person/index');?>"><?php echo ((isset($_SESSION['username']) && ($_SESSION['username'] !== ""))?($_SESSION['username']):'未登录'); ?></a></li>
                    <li><a href="<?php echo U('Home/Index/index');?>">返回前台</a></li>
                    <?php if(isset($_SESSION['username']) AND !empty($_SESSION['username'])): ?><li><a href="<?php echo U('Admin/Login/logoutDo');?>">退出</a></li>
                    <?php else: ?>
                        <li><a href="<?php echo U('Admin/Login/login');?>">登陆</a></li><?php endif; ?>
                    
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->

        <div class="navbar-default sidebar" role="navigation">
            <div class="sidebar-nav navbar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="sidebar-search">
                        <div class="input-group custom-search-form">
                            <input type="text" class="form-control" placeholder="Search...">
                            <span class="input-group-btn">
                            <button class="btn btn-default" type="button">
                                <i class="fa fa-search"></i>
                            </button>
                        </span>
                        </div>
                        <!-- /input-group -->
                    </li>
                    <li>
                        <a class="active" href="index.html"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
                    </li>
                    <li>
                        <a href="#">分类管理<span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a href="<?php echo U('Admin/Category/index');?>">分类列表</a>
                            </li>
                            <li>
                                <a href="<?php echo U('Admin/Category/add');?>">添加分类</a>
                            </li>
                        </ul>
                        <!-- /.nav-second-level -->
                    </li>
                    <li>
                        <a href="#">文章管理<span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a href="<?php echo U('Admin/Article/index');?>">文章列表</a>
                            </li>
                            <li>
                                <a href="<?php echo U('Admin/Article/add');?>">添加文章</a>
                            </li>
                        </ul>
                        <!-- /.nav-second-level -->
                    </li>
                    <li>
                        <a href="#">幻灯片管理<span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a href="<?php echo U('Admin/Slider/index');?>">幻灯片列表</a>
                            </li>
                            <li>
                                <a href="<?php echo U('Admin/Slider/add');?>">添加幻灯片</a>
                            </li>
                        </ul>
                        <!-- /.nav-second-level -->
                    </li>
                    <li>
                        <a href="#">用户管理<span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a href="<?php echo U('Admin/User/index');?>">用户列表</a>
                            </li>
                            <li>
                                <a href="<?php echo U('Admin/User/add');?>">添加用户</a>
                            </li>
                        </ul>
                        <!-- /.nav-second-level -->
                    </li>
                    
                </ul>
            </div>
            <!-- /.sidebar-collapse -->
        </div>
        <!-- /.navbar-static-side -->
          
    </nav>

    

    <!--PageContent-->
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">Tables</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <div class="row">
           <div class="col-md-12">
    <!--formBlock-->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        Basic Form Elements
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">

                        <div class="row">
                            <div class="col-lg-8">
                                <form action="" method="post" accept-charset="utf-8" role="form">
                                    <!--textInput-->
                                    <div class="form-group">
                                        <label>链接</label>
                                        <input class="form-control" name="url" value="<?php echo ((isset($row['url']) && ($row['url'] !== ""))?($row['url']):''); ?>" placeholder="Enter text">
                                    </div>
                                    <!--textInput-->
                                    <div class="form-group">
                                        <label>标题</label>
                                        <input class="form-control" name="title" value="<?php echo ((isset($row['title']) && ($row['title'] !== ""))?($row['title']):''); ?>" placeholder="Enter text">
                                    </div>
                                 

                    <div class="form-group">
                        当前照片: (点击选择文件修改照片)
                        <br/>
                        <?php if( isset($row['pic']) AND !empty($row.pic) ): ?><img src="/robot_henan<?php echo ((isset($row['pic']) && ($row['pic'] !== ""))?($row['pic']):''); ?>"><?php endif; ?>
                    </div>
                <div>
                    <div>
                    <input type="file"  id="upload">
                    <input type="hidden" name="pic" id="uploadify-hidden" value="">
                    </div>

                    <div>
                        <div id="uploadify-imagelist"></div>
                    </div>
                </div>

                                    <div class="form-group">
                                        <label>状态</label>
                                        <label class="radio-inline">
                                            <input type="radio" name="status" value="1" <?php if( isset($row['status']) AND ($row["status"] == 1) ): ?>checked<?php endif; ?> >正常显示
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="status"  value="0" <?php if( isset($row['status']) AND ($row["status"] == 0) ): ?>checked<?php endif; ?> > 隐藏 
                                        </label>
                                    </div>  



                                    <input type="hidden" name="id" value="<?php echo ((isset($row["id"]) && ($row["id"] !== ""))?($row["id"]):''); ?>"/>  
                                    <!--/formBlock-divider-->


                                    <button type="submit" class="btn btn-default">Submit Button</button>
                                    <button type="reset" class="btn btn-default">Reset Button</button>
                                </form>
                            </div>
                        </div>

                    </div>
                </div>
                <!--/PageContent-divider-->
           </div> 
        </div>

    </div> 
    

<!--/PageContent-->


    <!-- jQuery Version 1.11.0 -->
    <script src="/robot_henan/Public/Admin/js/jquery-1.11.0.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/robot_henan/Public/Admin/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/robot_henan/Public/Admin/js/plugins/metisMenu/metisMenu.min.js"></script>
    <script src="/robot_henan/Public/Admin/js/plugins/metisMenu/sb-admin-2.js"></script>
    
    <link href="/robot_henan/Public/static/uploadify/uploadify.css" rel="stylesheet">
    <script src="/robot_henan/Public/static/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript">
        $(function(){
        $("#upload").uploadify({
            'width'         : 120,//按钮宽
            'height'        : 30,//按钮高
            'buttonText'      : '选择文件',//按钮名称
            'swf'           : '/robot_henan/Public/static/uploadify/uploadify.swf',//flash地址
            //下面是后端相关
            "multi"         : false,//是否多图上传
            'auto'          : true,//是否自动上传
            'fileObjName'   : 'Filedata',
            'uploader'      : '<?php echo U("Uploadify/upload");?>',//处理上传的控制器
            'fileTypeExts'    : '*.jpg; *.png; *.gif;',
            'removeCompleted': true,//上传成功之后是否移除队列
            'removeTimeout' : 1,
            'onInit': function (){},        
            'onFallback'   : function() {
                alert('未检测到兼容版本的Flash.');
            },
            'onDialogClose': function(queueData){},
            'onUploadStart': function(){},
            'onUploadSuccess':  function(file, data, response) {
console.log(file);
console.log(data);// {"file":""}
console.log(response);//true 

                var result = $.parseJSON(data);
                //错误处理 巧妙的运用拦截手法，用拦截代替分支
                if(result.status == 0){ 
                    alert(result.info);
                    return false;
                }
                //上传成功
                    //设置隐藏域的值
                $('#uploadify-hidden').val(result.data.path);
                var id = Math.random().toString();
                id = id.replace('.','_'); //生成唯一标示 用于高级功能的识别例如 移除等
                var html = '<div id="'+id+'" style="background: F0F0F0;border: 1px solid #E0E0E0;  width: 160px; height:170px; overflow:hidden;" >';
                    html+= '<img height="160" width="160" src="/robot_henan'+result.data.path+'" />';
                    html+=  '</div>';
                $('#uploadify-imagelist').html(html);
            }
            
        });
    })
</script>


</body>

</html>